﻿






-- 修改人员基本信息
CREATE procedure [dbo].[Ryinfo_Update]
@sfzh varchar(18) ,
@xm varchar(10) ,
@xb bit ,
@jg varchar(15) ,
@gh varchar(20) ,
@csrq datetime ,
@mz varchar(10) ,
@ywpx bit ,
@xl varchar(10) ,
@zz varchar(300) ,
@lxdh varchar(50) ,
@jjllr varchar(30) ,
@lldh varchar(50) ,
@xp varchar(100) ,
@sfxyg bit,
@gz1 varchar(100),
@gz2 varchar(100),
@gz3 varchar(100),
@gz4 varchar(100),
@gz5 varchar(100),
@bzid varchar(20),
@sgz varchar(50)=null,
@jndj1 varchar(50)=null,
@jndj2 varchar(50)=null,
@jndj3 varchar(50)=null,
@fbid varchar(20)=null,
@htbh varchar(50)=null,
@xx varchar(50)=null,
@aqjycj varchar(50)=null,
@htyjpath varchar(50)=null
as
update Ry_Info set
xm=@xm,xb=@xb,jg=@jg,gh=@gh,csrq=@csrq,mz=@mz,
ywpx=@ywpx,xl=@xl,zz=@zz,lxdh=@lxdh,jjllr=@jjllr,lldh=@lldh,
xp=@xp,sfxyg=@sfxyg,gz1=@gz1,gz2=@gz2,gz3=@gz3,gz4=@gz4,gz5=@gz5,
sgz=@sgz,jndj1=@jndj1,jndj2=@jndj2,jndj3=@jndj3,htbh=@htbh,xx=@xx,
aqjycj=@aqjycj,htyjpath=@htyjpath
where sfzh=@sfzh

if(@bzid is not null)
begin
	if not exists(select 1 from Bzry_Info where sfzh=@sfzh)
	begin
		insert into Bzry_Info values(@bzid,@sfzh)
	end
	else
	begin
		update Bzry_Info set bzid=@bzid where sfzh=@sfzh
	end
end

if(@fbid is not null)
begin
	if not exists(select 1 from Fenbry_Info where sfzh=@sfzh)
	begin
		insert into Fenbry_Info values(@fbid,@sfzh)
	end
	else
	begin
		update Fenbry_Info set fbid=@fbid where sfzh=@sfzh
	end
end